package com.bw.liuyushan.mykotlin_firstmvptest.Adapter

import android.annotation.SuppressLint
import android.os.Parcel
import android.os.Parcelable
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter
import androidx.viewpager2.adapter.FragmentStateAdapter
import java.util.*
import kotlin.collections.ArrayList

/**
 *MyKotlin_FirstMVPTest
 *file name is : FragmentAdapters
 *created by Ender on 2021/9/16 15:21.
 *author : 刘雨杉
 *Describe:
 */
class FragmentAdapters(
    fm: FragmentManager,
    internal var fragments:ArrayList<Fragment>,
    internal var strings: ArrayList<String>
) : FragmentStatePagerAdapter(fm) {

    override fun getItem(position: Int): Fragment {
        return fragments[position]
    }

    override fun getCount(): Int {
        return fragments.size
    }

    override fun getPageTitle(position: Int): CharSequence? {
        return strings[position]
    }
}